<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// 7、`Promise.race`方法: (promises) => {}
	// (1) promises: 包含n个promise的数组
	// 说明: 返回一个新的promise, 第一个完成的promise的结果状态就是最终的结果状态
	const p1 = new Promise(function(resolve,reject){
		setTimeout(function(){
			resolve(100);
		},1000)
		
	});
	const p2 = new Promise(function(resolve,reject){
		setTimeout(function(){
			reject(200);
		},500)
	});
	const p3 = new Promise(function(resolve,reject){
		setTimeout(function(){
			reject(300);
		},3000)
	});
	const p4 = new Promise(function(resolve,reject){
		setTimeout(function(){
			resolve(400);
		},100)
	});
	const p = Promise.race([p1,p2,p3,p4]);
	console.log(p);
</script>
</html>